﻿using NUnit.Framework;
using System;
using TravisLight.Model.Entity;

namespace TravisLight.Model.Test.Entity
{
    [TestFixture]
    class RepoTest
    {
        [Test]
        public void TestStatusIsUnknownByDefault()
        {
            Repo repository = new Repo();
            Assert.That(repository.Status, Is.EqualTo(Status.Unknown));
        }

        [Test]
        public void TestStatusIsFailedIfLastBuildResultIsTrue()
        {
            Repo repository = new Repo() { LastBuildResult = true };
            Assert.That(repository.Status, Is.EqualTo(Status.Failed));
        }

        [Test]
        public void TestStatusIsPassedIfLastBuildResultIsFalse()
        {
            Repo repository = new Repo() { LastBuildResult = false };
            Assert.That(repository.Status, Is.EqualTo(Status.Passed));
        }

        [Test]
        public void TestStatusIsBuildingIfLastBuildStartedAtIsSet()
        {
            Repo repository = new Repo() { LastBuildStartedAt = new DateTime() };
            Assert.That(repository.Status, Is.EqualTo(Status.Building));
        }
    }
}
